﻿using System;
using System.Collections;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {

            Queue q = new Queue();
            q.Enqueue("马克思");
            q.Enqueue("恩格斯");
            q.Enqueue("毛泽东");
            //q.Clear();
            foreach (string i in q)
            {
                Console.WriteLine(i + "");
            }

            string s = (string)q.Dequeue();
            string s1 = (string)q.Dequeue();
            string s2 = (string)q.Dequeue();
            Console.WriteLine("第一个出队列的是:" + s);
            Console.WriteLine("第二个出队列的是:" + s1);
            Console.WriteLine("第三个出队列的是:" + s2);
            foreach (string j in q)
            {
                Console.WriteLine(j + "");
            }

            Program p = new Program();
            
            p.Clear();
            p.TrimToSize();
            p.Enqueue("Homosexual");
            p.Contains("obj");
        }
        public virtual void Clear()
        {
            Queue q1 = new Queue();
            q1.Enqueue("China");
            q1.Enqueue("American");
            q1.Enqueue("Japan");
            q1.Clear();
            Console.WriteLine("q1 = ",q1);
            
        }
        public virtual void TrimToSize()
        {
            Queue q2 = new Queue();
            q2.Enqueue("Apple");
            q2.Enqueue('B');
            Console.WriteLine("设置队列个数:" + q2.Count );
        }
        public virtual void Enqueue(object obj)
        {
            Queue q3 = new Queue();
            //q3.Enqueue("Woman");
            //q3.Enqueue("Man");
            Console.WriteLine("q3 = " + obj);
        }
        public virtual void Contains(object obj)
        {
            Queue q4 = new Queue();
            q4.Enqueue("A");
            q4.Enqueue("B");
            Console.WriteLine("是否有A：" + q4.Contains("A"));
        }

        


    }
        

}

